/*
 * Copyright 2008-2010 Maxim Starodubcev <starodubcevmax@gmail.com>
 * Copyright 2009-2010 Sergey Rudchenko <rudchenkos@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301  USA
 */

#include "circuit.h"
#include "ffilter.h"

#include <stdio.h>

void print_low_freq_filter(int topology)
{
    switch (topology)
    {
    case 1:
        printf("     L          \n");
        printf("o---^^^----+---o\n");
        printf("           |    \n");
        printf("          === C \n");
        printf("           |    \n");
        printf("o----------+---o\n");
        break;

    case 2:
        printf("    L         L    \n");
        printf("o--^^^---+---^^^--o\n");
        printf("         |         \n");
        printf("        === C      \n");
        printf("         |         \n");
        printf("o--------+--------o\n");
        break;

    case 3:
        printf("         L         \n");
        printf("o---+---^^^---+---o\n");
        printf("    |         |    \n");
        printf("   === C     === C \n");
        printf("    |         |    \n");
        printf("o---+---------+---o\n");
        break;
    }
}

void print_high_freq_filter(int topology)
{
    switch (topology)
    {
    case 1:
        printf("     C          \n");
        printf("o----||----+---o\n");
        printf("           |    \n");
        printf("           )    \n");
        printf("           ) L  \n");
        printf("           )    \n");
        printf("           |    \n");
        printf("o----------+---o\n");
        break;

    case 2:
        printf("   C        C    \n");
        printf("o--||---+---||--o\n");
        printf("        |        \n");
        printf("        )        \n");
        printf("        ) L      \n");
        printf("        )        \n");
        printf("        |        \n");
        printf("o-------+-------o\n");
        break;

    case 3:
        printf("        C         \n");
        printf("o---+---||---+---o\n");
        printf("    |        |    \n");
        printf("    )        )    \n");
        printf("    ) L      ) L \n");
        printf("    )        )    \n");
        printf("    |        |    \n");
        printf("o---+--------+---o\n");
        break;
    }
}

void print_filter_circuit(int filter_type, int topology)
{
    switch (filter_type)
    {
    case LOW_FREQ:
        print_low_freq_filter(topology);
        break;

    case HIGH_FREQ:
        print_high_freq_filter(topology);
        break;
    }
}
